<?php
include 'headers.php';
$res = $db->select_query('SELECT post_id, club_id, post_title, post_details, cr_by, cr_date FROM clubs_post WHERE club_id = ' . $db->antihack($_POST['clubid']) . ' AND post_id < ' . $_POST['id'] . ' ORDER BY post_id DESC LIMIT 10');
$countRow = mysql_num_rows($res);
if($countRow != 0)
{
    while($arr = $db->fetch($res))
    {
        $countReply = $db->num_rows('clubs_reply', 'reply_id', 'post_id = ' . $arr['post_id'] . '');
        ?>     
        <li data-ctype="clubListDetail" data-clubid="<?php echo $arr['club_id']; ?>" id="club_<?php echo $arr['post_id']; ?>" last_id="<?php echo $arr['post_id']; ?>" data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-li-has-count ui-li-has-thumb ui-btn-up-c">
            <div class="ui-btn-inner ui-li">
                <div class="ui-btn-text">
                    <a rel="external" href="?q=clubListDetail&cId=<?php echo $arr['post_id']; ?>" class="ui-link-inherit">
                        <img src="images/icon_clubListDetail.gif" alt="" width="80" height="80" class="ui-li-thumb">
                        <h3 class="ui-li-heading"><?php echo $arr['post_title']; ?></h3>
                        <p class="ui-li-desc"><?php echo 'โดบ : ' . $arr['cr_by'] . ' วันที่ : ' . $arr['cr_date']; ?></p>
                        <span class="ui-li-count ui-btn-up-c ui-btn-corner-all"><?php echo $countReply; ?></span>
                    </a> 
                </div>
                <span class="ui-icon ui-icon-arrow-r ui-icon-shadow">&nbsp;</span>
            </div>
        </li>                     
        <?php
    }
}
else
{
    echo '0';
}
?>